package com.xiecong.utils;


import com.xiecong.pojo.Emp;

public class CurrentHolder {

    // 从token中获取当前登录用户id及name
    private static final ThreadLocal<Emp> CURRENT_LOCAL = new ThreadLocal<>();

    public static void setCurrentEmp(Emp emp) {
        CURRENT_LOCAL.set(emp);
    }

    public static Emp getCurrentEmp() {
        return CURRENT_LOCAL.get();
    }

    public static void remove() {
        CURRENT_LOCAL.remove();
    }

    // 从token中获取当前登录用户的id
    //private static final ThreadLocal<Integer> CURRENT_LOCAL = new ThreadLocal<>();

    /*public static void setCurrentId(Integer employeeId) {
        CURRENT_LOCAL.set(employeeId);
    }

    public static Integer getCurrentId() {
        return (Integer) CURRENT_LOCAL.get();
    }

    public static void remove() {
        CURRENT_LOCAL.remove();
    }*/
}
